<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <script type="text/javascript">
        	var arr = [1,2,3,4,5,6,7,8]
        	//alert(arr.length)
        	var num =0
        	for(var i =0; i<=arr.length; i++){
        		num = num + i 
        	}
        	console.log( num / arr.length )
        </script>
    </head>
    <body>
    </body>
</html>